<?php
/* SVN FILE: $Id: add.ctp 34 2009-10-17 13:42:12Z kenreily@gmail.com $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * Recenseo: Online submission and reviewing for education
 * Copyright 2008-2009, Ken Reily
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * $Date: 2009-10-17 13:42:12 +0000 (Sat, 17 Oct 2009) $
 * $Revision: 34 $
 * $Author: kenreily@gmail.com $
 * $HeadURL: http://recenseo.googlecode.com/svn/trunk/app/views/assessment_ratings/add.ctp $
 */

  if (!empty($submission))
  {
?>
<h2>Please read and rate this randomly selected assessment.</h2>
<p>
<dl>
  <dt>Assignment</dt>
  <dd><?= $submission['Assignment']['name'] ?></dd>

  <dt>Grading Option</dt>
  <dd><?= $submission['GradingOption']['name'] ?></dd>

<?php
    if (!empty($submission['Submission']['comments'])) 
    {
?>  
  <dt>Comments</dt>
  <dd><?= $submission['Submission']['comments'] ?>&nbsp;</dd>
<?php
    }
?>
</dl>
</p>
<h4>Test Cases</h4>
<table width="100%">
<?php
  echo $html->tableHeaders(array('#','Name','Description','Results','Outcome'));
    
  if (count($test_cases) > 0)
  {
    foreach ($test_cases as $test_case)
    {
      echo $html->tableCells(array($test_case['TestCase']['id'],
                                   $test_case['TestCase']['name'],
                                   $test_case['TestCase']['description'],
                                   $test_case['AssessmentTestCase']['results'],
                                   $test_case['TestCaseResult']['name']),
                             null,
                             array('class' => 'altrow'));
    }        
  }
  else
  {
?>
<tr><td colspan="6">No Test Cases Found.</td></tr>
<?php
  }
?>
</table>
<p><?=count($test_cases) ?> Completed Test Cases</p>
<br>
<h4>Submission Qualities</h4>
<table>
<?php
    echo $html->tableHeaders(array('Quality','Response','Comments'));
    
    foreach ($qualities as $quality)
    {
      if (empty($quality['LikertResult']['name']))
      {
        $response = '(None)';
      }
      else
      {
        $response = $quality['LikertResult']['name'];
      }
      
      $comments = $quality['AssessmentQualityAttribute']['comments'];
      
      if (empty($comments))
      {
        $comments = '(None)';
      }
             
      echo $html->tableCells(array($quality['QualityAttribute']['name'],$response,$comments),null,array('class' => 'altrow'));
    }
?>
</table>
<?php
    echo $form->create('AssessmentRating',array('action' => "/add/{$submission['Assignment']['id']}"));
    echo $form->input('user_id',array('type' => 'hidden'));
    echo $form->input('assessment_id',array('type' => 'hidden'));
    echo $form->input('rating',array('type' => 'radio',
                                     'label' => 'Please rate this assessment on the following scale:',
                                     'options' => array(5 => '5 - Exceptional',
 			                                4 => 4,
						        3 => '3 - Good',
							2 => 2,
							1 => '1 - Cursory; course staff should review this assessment')));
    echo $form->input('comments');
    echo $form->end('Submit');
  }
?>